<?php
include_once(dirname(__FILE__) . "/../inc/common.php");

$subjectId = isset($_GET["subjectId"]) ? $_GET["subjectId"] + 0 : 0;
$tallyAccountClass = new tally_account();
$account = $tallyAccountClass->findAccountByAccountId($userId, $subjectId);
?>
<div class="titlebar">
    <h3>记账-<?php echo $account["name"] ?></h3>
</div>
<!-- begin:搜索区 -->
<div class="tab_wrapper">
    <div class="body">
        <div class="toolbar">
            <p>
                <a class="button" title="记收入" href="javascript:fGoto();"
                   onclick="Income.goAdd('11','<?php echo $subjectId ?>');CM.afterSubmit=Cash.search;CM.afterSubmit0=Tally.loadBoard;"><span>记收入</span></a>
                <a class="button" title="记支出" href="javascript:fGoto();"
                   onclick="Expense.goAdd('20','<?php echo $subjectId ?>');CM.afterSubmit=Cash.search;CM.afterSubmit0=Tally.loadBoard;"><span>记支出</span></a>
                <a class="button" title="记转账" href="javascript:fGoto();"
                   onclick="Transfer.goAdd('30','<?php echo $subjectId ?>');CM.afterSubmit=Cash.search;CM.afterSubmit0=Tally.loadBoard;"><span>记转账</span></a>
            </p>
        </div>
        <form id="schForm" name="schForm" method="post">
            <div class="searchbar" id="searchbar">
                <div class="base_condition">
                    <table>
                        <tr>
                            <td><SELECT id="dateSpan" NAME="dateSpan"
                                        onChange="updateDate('dateSpan','dateFrom','dateTo');">
                                    <option value="" selected>日期</option>
                                    <option value="today">今日</option>
                                    <option value="theWeek">本周</option>
                                    <option value="theMonth">本月</option>
                                    <option value="theQuarter">本季度</option>
                                    <option value="theYear">今年</option>
                                    <option value="lastWeek">上周</option>
                                    <option value="lastMonth">上月</option>
                                    <option value="lastQuarter">上季度</option>
                                    <option value="lastYear">去年</option>
                                    <option value="last7Day">近7天</option>
                                    <option value="last30Day">近30天</option>
                                    <option value="custom">自定义</option>
                                </SELECT>
                            </td>
                            <td>
                                从<INPUT class="Wdate date" TYPE="text" id="dateFrom" NAME="dateFrom"
                                        onFocus="WdatePicker();" value="" onChange="updateType('dateSpan');">
                                至<INPUT class="Wdate date" TYPE="text" id="dateTo" NAME="dateTo"
                                        onFocus="WdatePicker();" value="" onChange="updateType('dateSpan');">
                            </td>
                            <td>
                                金额&nbsp;&gt;=
                                <input id="minAmount" name="minAmount" class="text" type="text" value="">
                                &lt;=<input id="maxAmount" name="maxAmount" class="text" type="text" value="">
                            </td>
                            <td>
                                <select name="inOrOut">
                                    <option value="">所有</option>
                                    <option value="3">收入</option>
                                    <option value="4">支出</option>
                                    <option value="2">转账</option>
                                </select>
                            </td>
                            <td>
                                <select name="orderField">
                                    <option value="">排序方式</option>
                                    <option value="amountDesc">金额从大到小</option>
                                    <option value="amountAsc">金额从小到大</option>
                                    <option value="tradeTimeDesc">日期由近及远</option>
                                    <option value="tradeTimeAsc">日期由远及近</option>
                                </select>
                            </td>
                        </tr>
                    </table>
                </div>
                <table class="complex_condition">
                    <tr>
                        <td>
                            <label for="categoryName">
                                收支类别:
                            </label>
                        </td>
                        <td>
                            <input type="hidden" id="categoryId" name="categoryId"/>
                            <input type="text" class="text rd" id="categoryName" name="categoryName" readonly="readonly"
                                   onClick="CM.clearValue(this);">
                            <a title="收支类别" href="#"
                               onclick="CategoryPicker.open(this);return false;"><img
                                        src="../images/icons/select.gif" align="absmiddle"/>
                            </a>
                        </td>
                        <td><label for="tagId">标签:</label></td>
                        <td>
                            <input type="hidden" id="tagId" name="tagId" value=""/>
                            <input type="text" class="text rd" id="tagName" name="tagName" readonly="readonly"
                                   onclick="CM.clearValue(this);">
                            <a title="选择标签" href="javascript:fGoto();" onclick="TagPicker.open(this);return false;"><img
                                        src="../images/icons/select.gif" align="absmiddle"/></a>
                        </td>

                        <td><label for="remark">说明:</label></td>
                        <td><input id="remark" name="remark" class="text" type="text" value=""></td>

                        <td>
                            <input id="searchBtn" class="button" type="button" value="查询"
                                   onclick="Cash.pg.params='';Cash.search();"/>
                            <input type="hidden" id="subjectId" name="subjectId" value="<?php echo $subjectId ?>"/>
                        </td>
                    </tr>
                </table>
            </div>
        </form>
        <div id="dataView" class="data">
            <div align="center"></div>
        </div>
        <!-- end:---------主数据区 -->
    </div>
</div>
